import request from '@/utils/request'

/**
 * 分页查询考勤记录
 */
export function getAttends(currentPage, pageSize, limit) {
  return request({
    url: '/attend/list.json',
    method: 'post',
    data: {
      pageQueryParam: {
        currentPage, pageSize
      },
      limit
    }
  })
}

export function getMonthAttends(year, month, departId) {
  return request({
    url: '/attend/listByMonth.json?year=' + year + '&month=' + month + '&departId= ' + departId,
    method: 'get'
  })
}

export function addAttend(attendObj) {
  return request({
    url: '/attend/add.do',
    method: 'post',
    data: attendObj
  })
}

export function deleteAttend(attendId) {
  return request({
    url: '/attend/delete.action',
    method: 'post',
    data: {
      attendId: attendId
    }
  })
}

export function genAttendRecords(departId, startDate, endDate) {
  return request({
    url: '/attend/gen.action?departId=' + departId + '&startDate=' + startDate + '&endDate=' + endDate,
    method: 'get'
  })
}
